package com.qcby.controller;

import com.qcby.entity.User;
import com.qcby.entity.vo.UserVo;
import com.qcby.service.UserService;
import com.qcby.util.ResultObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * @author haozeWang
 * @create 2021-08-20 15:07
 */
@Controller
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;
    /*登录验证*/
    @RequestMapping("/login")
    @ResponseBody
    public ResultObject login(UserVo user, HttpServletRequest request, HttpServletResponse response){
        ResultObject resultObject=userService.login(user, request, response);
        return resultObject;
    }

    /*获取验证码*/
    @RequestMapping("/getcode")
    public void getCode(HttpServletRequest request, HttpServletResponse response) throws IOException {
        userService.getCode(request,response );
    }

}
